<?php
require_once 'mysql.config.php';
if (isset($_POST['ok'])) {
    require_once ("classes/db.class.php");
    $id = $_POST['uname'];

    
    $link = new DataBase($db_address, $db_username, $db_password, $db_db);
    $link->select("users", "*", "id='$id'");

    if ($link->getCount() == 1) {
        session_start();
        session_register("uid");
        $_SESSION['uid'] = $id;
        header("location:index.php?id=$id");
    } else {
        $err = "nu labai nekokie duomenys";
        header("location:index.php?err=$err");
    }
}
?>
<html>
    <div>
        <form action="" method="post">
            <input type="text" name="uname" placeholder="Username"/>
            <input type="password" name="pass" placeholder="Password"/>
            <input type="submit" name="ok" value="Login"/>
        </form>
    </div>
</html>